import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
import request from './utils/request'

import '@/icons' // icon
import '@/permission' // permission control
// 在main.js中导入
// import * as '别名' 全部导入
// 批量导入
import * as diretives from '@/diretives'

// 导入插件
import components from './components'
// 使用插件
Vue.use(components)

for (const key in diretives) {
  Vue.directive(key, diretives[key])
}
import PageTools from '@/components/PageTools'
Vue.component('PageTools', PageTools)
/* Object.keys(diretives).map(item => {
  console.log(diretives[item])
  return Vue.directive(item, diretives[item])
}) */

// 导入后注册
/* Vue.directive('imgerror', imgerror)
Vue.directive('color', color) */

// set ElementUI lang to EN
/* Vue.use(ElementUI, { locale }) */
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)
Vue.prototype.$request = request
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
